#include "reportdialog.h"
#include "ui_reportdialog.h"

reportDialog::reportDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::reportDialog)
{
    ui->setupUi(this);
}

reportDialog::~reportDialog()
{
    delete ui;
}

void reportDialog::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void reportDialog::setData( QList<QTreeWidgetItem *> itemList )
{
    int counter = 1;
    for ( int i = itemList.count()-1; i >= 0; i-- )
    {
        QTreeWidgetItem * item = new QTreeWidgetItem( ui->treeWidget );
        item->setText( 0, QString::number(counter++) );
        item->setText( 1, itemList.at(i)->text(0) );
        item->setText( 2, itemList.at(i)->text(23) );
    }
    ui->treeWidget->resizeColumnToContents(0);
    ui->treeWidget->resizeColumnToContents(1);
    ui->treeWidget->resizeColumnToContents(2);
}

void reportDialog::on_closeButton_clicked()
{
    accept();
}
